<?php
	require_once 'models/models_ncc.php';
	$mod = $_GET['mod'];
	$obncc = new models_ncc();

	switch ($mod){
		case 'ncc':{
			
			$data['list'] = $obncc->_listncc();
			
			require 'views/admin/ncc/index.php';
			break;
		}
		case 'addncc':{
			if($_POST){
				$obncc->_addncc($_POST['tenncc']);
				echo '<script> window.location.href="admin.php?mod=ncc"</script>';
			}
			require 'views/admin/ncc/add.php';
			break;
		}
		case 'delncc':{
			$obncc->_delncc($_GET['ma']);
			echo '<script> window.location.href="admin.php?mod=ncc"</script>';
			break;
		}
		case 'updatencc':{
			if($_POST){
				$obncc->_updatencc($_POST['tenncc'], $_GET['ma']);
				echo '<script> window.location.href="admin.php?mod=ncc"</script>';
			}
			$data = $obncc->_getncc($_GET['ma']);
			require 'views/admin/ncc/edit.php';
			break;
		}
		default: echo 'Yeu cau khong duoc xu ly'; break;
	}
?>